//index.js
//获取应用实例
const app = getApp()

Page({
	data: {
		on_news: 'on',
		g_iphone: '',
	},
	onReady: function() {
		app.SystemInfo(this)
	},
	form_id_get: function(e) {
		app.request(app.apiDomain + "index.php?c=user&a=addFormId&type=form_id", {
			form_id: e.detail.formId,
		}, function(res) {
			console.log(res.data.info);
		});
	},
	onShareAppMessage: function() {
		return {
			title: '「趣味画像」让健康更简单',
			imageUrl: 'https://resource.160nurse.com/upload/miniprogram/index.jpeg'
		}
	},
	hd_click: function(options) {
		var that = this;
		app.request(app.apiDomain + "index.php?c=health&a=news", {
			type:options.target.id,
		}, function(res) {
			that.setData({
				news_list: res.data.data.list,
				news_data: res.data.data,
				top_one: res.data.data.top_one,
			});
		});	
		app.request(app.apiDomain + "index.php?c=health&a=category", {
			type:options.target.id,
		}, function(res) {
			that.setData({
				fen_lei: res.data.data,
			});
		});	
	},
	onLoad: function(options) {
		var that = this;
		app.request(app.apiDomain + "index.php?c=health&a=news", {
			type : options.type
		}, function(res) {
			that.setData({
				news_list: res.data.data.list,
				news_data: res.data.data,
				top_one: res.data.data.top_one,
			});
		});
		app.request(app.apiDomain + "index.php?c=health&a=category", {
			type : options.type
		}, function(res) {
			that.setData({
				fen_lei: res.data.data,
			});
		});
	},
	onShareAppMessage: function() {
		return app.onShareAppMessage();
	},
})
